﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace CPlase.Internal
{
    public interface IWorkerQueueHandler
    {
        bool HandleQueue(string Message);
    }

    public static class WorkerQueueHandlerExtensions
    {

        private static string CleanUpQueueName(string DirtyQueueName)
        {
            return DirtyQueueName.Substring(0, DirtyQueueName.IndexOf(",")).ToLowerInvariant().Replace(".", "-");
        }

        public static string GetQueueName(this IWorkerQueueHandler Handler)
        {
            return CleanUpQueueName(Handler.GetType().AssemblyQualifiedName);
        }

        public static string GetQueueName(Type HandlerType)
        {
            return CleanUpQueueName(HandlerType.AssemblyQualifiedName);
        }
    }
}